using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace EmployeeForm
{
    public class UtlEmployee
    {
        UTLDB.UTLDB _cn = new UTLDB.UTLDB();
        public UtlEmployee()
        {
       
        }
        public DataTable GetEmployee()
        {
            DataTable data = new DataTable();
            data = _cn.GetDataByStoredProcedure("sp_SelecttblMembersAll");
            return data;

        }
        
        public int InsertEmployee(Employee ey)
        { 
            int id = _cn.ExecuteInsert("sp_InserttblMember",
                new string[] { "@UserName","@Password","@FullName","@AuthenticationID","@Email","@Address","@IdentityCardNumber","@Phone","@Birthday","@Pic","@Active"},
                new object[] {ey.UserName,ey.Password,ey.FullName,ey.AuthenticationID,ey.Email,ey.Address, ey.IdentityCardNumber, ey.Phone, ey.Birthday,ey.Pic,ey.Active});
            return id;
        }

        public void UpdateEmployee(Employee ey)
        {
            _cn.ExecuteNonQuery("sp_UpdatetblMember",
                new string[] { "@ID", "@UserName", "@Password", "@FullName", "@AuthenticationID", "@Email", "@Address", "@IdentityCardNumber", "@Phone", "@Birthday", "@Pic", "@Active" },
                new object[] {ey.ID, ey.UserName, ey.Password, ey.FullName, ey.AuthenticationID, ey.Email, ey.Address, ey.IdentityCardNumber, ey.Phone, ey.Birthday, ey.Pic, ey.Active });
        
        }

        public void DeleteEmployee(string UserName) {
            _cn.ExecuteNonQuery("sp_DeletetblMember",
                   new string[] { "@UserName" },
                   new object[] { UserName });
   
        }

        public DataTable GetAuth() {
            DataTable data = new DataTable();
            data = _cn.GetDataByStoredProcedure("sp_SelecttblAuthenticationsAll");
            return data;
        }
    }


}
